package com.maidshop.elasticsearch.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

/**
 * 动画es对象
 */
@Document(indexName = "animation")
@Data
public class AnimationEs {

    // 文档主键，唯一标识
    @Id
    @Field(store = true, index = false, type = FieldType.Integer)
    private Long id;

    // 动画名称
    @Field(store = true, index = true, analyzer = "ik_smart", searchAnalyzer = "ik_smart", type = FieldType.Text)
    private String name;

    /**
     * 发布时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @Field(store = true, index = false, type = FieldType.Date)
    private Date releaseDate;

    /**
     * 完结时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @Field(store = true, index = false, type = FieldType.Date)
    private Date endDate;

    // 动画类型
    @Field(store = true, index = true, analyzer = "ik_smart", searchAnalyzer = "ik_smart", type = FieldType.Text)
    private String type;

    /**
     * 总集数
     */
    @Field(store = true, index = false, type = FieldType.Integer)
    private Integer episodes;

    /**
     * 状态(0 未知 1 已完结 2 更新中)
     */
    @Field(store = true, index = false, type = FieldType.Integer)
    private Integer status;

    // 动画简介
    @Field(store = true, index = true, analyzer = "ik_smart", searchAnalyzer = "ik_smart", type = FieldType.Text)
    private String intro;

    /**
     * 封面
     */
    @Field(store = true, index = false, type = FieldType.Text)
    private String cover;

    /**
     * 文件id
     */
    @Field(store = true, index = false, type = FieldType.Text)
    private String fileId;
}
